How To Build D-Bus for ARM


Intro


In this How To we are going to build D-Bus 1.8.0 with our GCC/G++ 4.8.2 cross-compiler. Be sure to start this build in a new terminal/tab to avoid any pollution from previous builds.

Tar Balls


Here is a list of source packages that we'll need for the build. You can either download them now or wait 'til later in the How To.
  • dbus-1.8.0.tar.gz

You'll also need Expat for this build.

Create a Workspace


I recommend creating a workspace under your /home/<your user>/ directory that is dedicated to this build. So let's fire up your terminal and run the following:
$ export DBUS_SRC=~/workbench/dbus/src
$ export DBUS_BUILD=~/workbench/dbus/build
$ mkdir -pv ~/workbench/dbus
$ mkdir $DBUS_SRC && mkdir $DBUS_BUILD
$ cd $DBUS_SRC

Gather the Sources


Now that we have a workspace created and we are currently in the src directory we can begin bringing down the sources and extracting them.

dbus

$ wget http://dbus.freedesktop.org/releases/dbus/dbus-1.8.0.tar.gz
$ tar -pxzf dbus-1.8.0.tar.gz

Build Environment


To make things a little smoother let's setup some environment variables:
$ export INSTALLDIR=~/workbench/gcc-g++-4.8.2/arm
$ export PATH=$INSTALLDIR/bin:$PATH
$ export TARGETMACH=arm-none-linux-gnueabi
$ export BUILDMACH=i686-pc-linux-gnu
$ export CROSS=arm-none-linux-gnueabi
$ export CC=${CROSS}-gcc
$ export LD=${CROSS}-ld
$ export AS=${CROSS}-as
$ export CXX=${CROSS}-g++
NOTE: Depending on whether you are using a cross-compiler built from my other wikis you might need to change INSTALLDIR to point to your cross-compiler.

Build D-Bus


Yeah, this is a little janky :P
$ cd ../build/
$ export PKG_CONFIG_PATH=/home/<your user>/workbench/expat/final/usr/lib/pkgconfig
$ ../src/dbus-1.8.0/./configure INSTALLDIR=/home/<your user>/workbench/gcc-g++-4.8.2/arm PATH=$INSTALLDIR/bin:$PATH TARGETMACH=arm-none-linux-gnueabi BUILDMACH=i686-pc-linux-gnu CC=arm-none-linux-gnueabi-gcc LD=arm-none-linux-gnueabi-ld AS=arm-none-linux-gnueabi-as CXX=arm-none-linux-gnueabi-g++ --prefix=/usr --host=$TARGETMACH --enable-abstract-sockets CFLAGS=-I/home/<your user>/workbench/expat/final/usr/include LDFLAGS=-L/home/<your user>/workbench/expat/final/usr/lib --enable-tests=no
$ make
$ make DESTDIR=/home/<your user>/workbench/dbus/final install
 

Output


cd into the final directory and output its contents:
$ cd ../final/usr/
$ ls
You should have the following directories:
  • bin
  • etc
  • include
  • lib
  • libexec
  • share
  • var

Make sure the binaries are for ARM:
$ cd bin/
$ file dbus-daemon
bash: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
If you see something similar to above you're good to go ;-)

Lastly, move the contents of these directories, or the directories themselves if they do not already exist, to your custom Linux file system or dev board.